<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    /* 
      .then方法的返回值是一个新的Promise实例
    */
  //  const p = new Promise((resolve, reject) => {
  //   setTimeout(() => {
  //     resolve(100)
  //   }, 1000);
  //  })
  // Promise.resolve:用于快速返回一个状态为fulFilled的Promise的实例对象
  //  Promise.reject:用于快速返回一个状态为rejected的Promise的实例对象
  const p0 = Promise.resolve(100)
  console.log(p0);
  // 这里的p0是拿到的是p0成功的Promise值也就是100
  const p = Promise.resolve(p0)
  console.log(p);

  // 结果是失败了
  // const p0 = Promise.reject(100)
  // const p = Promise.resolve(p0)

  // 下面也是失败
  // const p0 = Promise.resolve(100)
  // const p = Promise.reject(p0)
   p.then(
    res => {},
    err => {}
   )
  </script>
</body>
</html>